#pragma once
#include<string>
#include<unistd.h>
//对管道的先描述后组织
class channel
{
public:
    channel(int wfd,pid_t who):_wfd(wfd),_who(who)
    {
        _name="channel-"+std::to_string(who)+"-"+std::to_string(wfd);
    }
    int wfd()
    {
        return _wfd;
    }
    pid_t who()
    {
        return _who;
    }
    std::string name()
    {
        return _name;
    }
    void send(int taskid)
    {
        ::write(_wfd,&taskid,sizeof(taskid));
    }
    ~channel()
    {

    }
private:
    int _wfd;
    pid_t _who;
    std::string _name;
};